
package com.rt.schedulenew.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.rt.schedulebase.dto.ExamApplyPatientIdDto;
import com.rt.schedulebase.entity.ExamApplyPatientId;
import com.rt.schedulebase.mapper.ExamApplyPatientIdMapper;
import com.rt.schedulenew.api.IExamApplyPatientIdService;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
@Component
public class ExamApplyPatientIdServiceImpl extends ServiceImpl<ExamApplyPatientIdMapper, ExamApplyPatientId> implements IExamApplyPatientIdService {

    @Override
    public List<ExamApplyPatientId> selectList(ExamApplyPatientIdDto dto) {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("SICK_ID", dto.getSickId());
        map.put("PATIENT_ID", dto.getPatientId());
        map.put("DOMAIN_ID", dto.getDomainId());
        map.put("HOSPITAL_CODE", dto.getHospitalCode());
        QueryWrapper<ExamApplyPatientId> examApplyPatientIdQw = new QueryWrapper<>();
        if (dto.getDomainIdList() != null && !dto.getDomainIdList().isEmpty()) {
            examApplyPatientIdQw.in("DOMAIN_ID", dto.getDomainIdList());
        }
        examApplyPatientIdQw.allEq(map, false);
        return baseMapper.selectList(examApplyPatientIdQw);
    }


    @Override
    public List<ExamApplyPatientId> selectd(ExamApplyPatientIdDto dto) {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("SICK_ID", dto.getSickId());
        map.put("DOMAIN_ID", dto.getDomainId());
        map.put("PATIENT_ID", dto.getPatientId());
        map.put("HOSPITAL_CODE", dto.getHospitalCode());
        QueryWrapper<ExamApplyPatientId> qw = new QueryWrapper<>();
        qw.allEq(map, false);
        return baseMapper.selectList(qw);
    }
}
